package com.kws.system.controller.Payment;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.kws.common.core.domain.R;
import com.kws.system.domain.payment.info.QueryServerOrderInfo;
import com.kws.system.domain.payment.rq.QueryCommodityPayOrderRq;
import com.kws.system.service.payment.OrderManagementService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <b>ServerPayOrderController</b>
 *
 * @description: ServerPayOrderController <br>
 * @date: 2024/11/22 17:32 <br>
 * @author: lhm <br>
 * @version: 1.0 <br>
 */

@Api(tags = "服务支付订单管理模块")
@RestController
public class ServerPayOrderController {
    private static final Logger logger = LoggerFactory.getLogger(ServerPayOrderController.class);

    @Autowired
    private OrderManagementService orderManagementService;

    @ApiOperation("分页查询服务支付订单列表")
    @PostMapping("/query/serverOrder/page")
    public R<Page<QueryServerOrderInfo>> queryServerOrderPage(@RequestBody QueryCommodityPayOrderRq rq){
        Page<QueryServerOrderInfo> pageInfo = orderManagementService.queryServerOrderPage(rq);
        return R.ok(pageInfo);
    }

    @ApiOperation("根据ID及项目ID查询服务订单列表")
    @GetMapping("/query/serverOrder/list")
    public R<List<QueryServerOrderInfo>> queryServerOrderList(@RequestParam Long id,@RequestParam Long itemId){
        List<QueryServerOrderInfo> serverOrderList = orderManagementService.queryServerOrderList(id,itemId);
        return R.ok(serverOrderList);
    }

    @ApiOperation("/根据ID查询服务支付订单详情")
    @GetMapping("/query/serverOrder/byId")
    public R<QueryServerOrderInfo> queryServerOrderById(@RequestParam Long id){
        QueryServerOrderInfo info = orderManagementService.queryServerOrderById(id);
        return R.ok(info);
    }
}
